#include <iostream>
using namespace std;

//select m random number from 0 to n-1
void genknuth(int n, int m)
{
	srand(time(0));
	for(int i=0; m>0; i++)
	{
		if(rand() % n < m)
		{
			cout << i << " "; 
			m--;
		}
		n--;
	}
}

int main()
{
	for(int i=0;i<10;i++)
	{
		genknuth(10,5);
		sleep(1);
		cout << endl;
	}
	return 0;
}
